function S = GenerateState(width, height,num_players_r, num_players_b)

% generate random ball
B_X = round(rand_num((-width/2), (width/2)));
B_Y = round(rand_num((-height/2), (height/2)));
B={[B_X,B_Y]};

S={B};

% generate players
for player_num = 1:num_players_r,
    P = GeneratePlayer(width, height, player_num, 'r');
    S=[S {P}];
end

for player_num = 1:num_players_b,
    P = GeneratePlayer(width, height, player_num, 'b');
    S=[S {P}];
end

end

function P = GeneratePlayer(width, height, num, color)
    P_X = round(rand_num((-width/2), (width/2)));
    P_Y = round(rand_num((-height/2), (height/2)));
    P_theta = round(rand_num(0.5,8.5))*45;
    P_color=color;
    P_num=num;
    
    P={[P_X,P_Y,P_theta],P_color,P_num};

end